package com.xxxx.seckill.utils;

import org.thymeleaf.util.StringUtils;

import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
 * @author heyanfeng
 * @version 1.0
 * @description:  手机号码校验类
 * @date 2022/7/29 16:02
 */
public class ValidatorUtil {

    private static final Pattern mobile_patten = Pattern.compile("[1]([3-9])[0-9]{9}$");

   /**
    * @Author heyanfeng
    * @Description   手机号码验证方法
    * @Date 16:54 2022/7/29
    * @Param [mobile]
    * @return boolean
    **/
    public static boolean isMobile(String mobile) {
        if (StringUtils.isEmpty(mobile)) {
            return false;
        }
        Matcher matcher = mobile_patten.matcher(mobile);
        return matcher.matches();
    }
}
